package com.atguigu.exer.meiju1;

public enum Color {
    RED(255,0,0,"赤"),
    ORANGE(255,128,0,"橙"),
    YELLOW(255,255,0,"黄"),
    GREEN(0,255,0,"绿"),
    CYAN(0,255,255,"青"),
    BLUE(0,0,255,"蓝"),
    PURPLE(128,0,255,"紫");
    private final int red;
    private final int green;
    private final int blue;
    private final String description;

    //如果所有属性都是final的，通常情况下无参构造都是不写的。
    //如果要写无参构造，必须在无参构造中，为所有属性指定默认值
    /*Color() {
        red = 0;
        green = 0;
        blue = 0;
        description = "";
    }*/

    Color(int red, int green, int blue, String description) {
        this.red = red;
        this.green = green;
        this.blue = blue;
        this.description = description;
    }

/*    @Override
    public String toString() {
        return "Color{" +
                "red=" + red +
                ", green=" + green +
                ", blue=" + blue +
                ", description='" + description + '\'' +
                '}';
    }*/

    @Override
    public String toString() {
        return name() + "(" + red +"," + green +"," + blue +")->" + description;
    }
}
